<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 100px;
        height: 100px;
        background-color: pink;
      }
    </style>
    <script src="js/jquery1.42.min.js"></script>
  </head>
  <body>
    <div></div>
    <hr />
    <button>显示与隐藏</button>
    <script>
      var btn = document.querySelector("button");
      var div = document.querySelector("div");
      var $div = $("div");
      btn.onclick = function () {
        $div.toggle();
      };
    </script>
  </body>
</html>
